import java.util.HashSet;
import java.util.Set;

class TreeNode {
    int val;
      TreeNode left;
      TreeNode right;
     TreeNode() {}
    TreeNode(int val) { this.val = val; }
     TreeNode(int val, TreeNode left, TreeNode right) {
         this.val = val;
         this.left = left;
         this.right = right;
     }
 }
public class Test {
    public static void main(String[] args) {
        //int tmp = dfs(root,root.val);
        Set<Integer> set = new HashSet<>();
        int[] arr = {3,3,3,1,2,1,1,2,3,3,4};
        set.add(1);
        set.add(2);
        set.add(3);
        System.out.println(set.size());
    }

    //129.求二叉树根结点到叶子结点之和
    public static int dfs(TreeNode root,int preSum) {

        if(root == null) return 0;
        int nowSum = preSum * 10 + root.val;
        int leftSum = dfs(root.left,nowSum);
        int righttSum = dfs(root.right,nowSum);
        return leftSum + righttSum;
    }
    //打家结舍Ⅱ
    public int rob(int[] nums) {
        int n = nums.length;
        if(n==1) return nums[0];
        if(n==2) return nums[0]>nums[1]?nums[0]:nums[1];
        int x=0,y=0;
        {
            int[] f = new int[n];
            int[] g = new int[n];
            f[2] = nums[2];
            for(int i=3;i<n-1;i++) {
                f[i]=g[i-1] +nums[i];
                g[i]=Math.max(g[i-1],f[i-1]);
            }
            x=nums[0]+Math.max(f[n-2],g[n-2]);
        }
        {
            int[] f = new int[n];
            int[] g = new int[n];
            f[1] = nums[1];
            for(int i=2;i<n;i++) {
                f[i]=g[i-1] +nums[i];
                g[i]=Math.max(g[i-1],f[i-1]);
            }
            y=Math.max(f[n-1],g[n-1]);
        }
        return Math.max(x,y);
    }


}
